
<?php include("header.php"); ?>
<script type="text/javascript" src="<?php echo APPLICATION_URL ?>/public/js/jquery-ui-1.8.16.custom.min.js"></script>
<link type="text/css" href="<?php echo APPLICATION_URL ?>/public/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo APPLICATION_URL ?>/public/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js"></script>

<script type="text/javascript">
function addShipArriving() {
    window.location.href = "<?php echo APPLICATION_URL;?>/ship_schedule/arriving_form/";
}

$(document).ready(function() {
     $('#start_date').datetimepicker({
        dateFormat: "dd/mm/yy",
        stepMinute: 5
    });
    $('#end_date').datetimepicker({
        dateFormat: "dd/mm/yy",
        stepMinute: 5
    });
});
</script>
	<div class="one_third">
		<div class="box_tool">
			<div class="box_head"><?php echo _LB_TOOLBOX; ?></div>

			<div class="box_content">
                <a id="auto_ship_schedule_add" href="#" onclick="addShipArriving();">
					<?php echo _LB_ADD_SHIP_SCHEDULE_ARRIVING; ?>
				</a>
			</div>
		</div>
		<div class="spacer"></div>
		<div class="box_tool">
			<div class="box_head"><?php echo _LB_SEARCH; ?></div>
			<div class="box_content" id="filter_panel">
				<table>
				<form name='form_filter' method="post" action="">
				<tr>
                    <td width="20%"><label><?php echo _LB_START_DATE; ?>&nbsp;:&nbsp;</label></td>
                    <td><input name="start_date" class="inputbox smallbox" id="start_date" type="text" size="<?php echo SIZE_NAME; ?>" value="<?php echo $filter['start_date']; ?>"/>
                    </td>
                </tr>
                <tr>
                    <td width="20%"><label><?php echo _LB_END_DATE; ?>&nbsp;:&nbsp;</label></td>
                    <td><input name="end_date" class="inputbox smallbox" id="end_date" type="text" size="<?php echo SIZE_NAME; ?>" value="<?php echo $filter['end_date']; ?>"/>
                    </td>
                </tr>
                <tr>
					<td width="40%"><?php echo _LB_SHIP_NAME; ?></td>
					<td width="60%">
						<input type="text" name="name" id="name" value="<?php echo $filter['name']; ?>" style="width: 180px;"/>
					</td>
				</tr>
                 <tr>
					<td width="40%"><?php echo _LB_ARRIVING_PORT; ?></td>
					<td width="60%">
						<input type="text" name="port" id="port" value="<?php echo $filter['port']; ?>" style="width: 180px;"/>
					</td>
				</tr>
                    <tr>
                        <td width="40%"><?php echo _LB_NATIONALITY; ?></td>
					<td width="60%">
						<select id="country" name="country" style="width: 180px;">
                            <option value=""><?php echo _LB_CHOOSE; ?></option>
                            <?php while($country->fetchNext()) { ?>
                               <option value="<?php echo $country->id; ?>" <?php if($country->id == $filter['country']) {?>selected="true"<?php }?>><?php echo $country->name; ?></option>
                            <?php } ?>
                        </select>
					</td>
                    </tr>
                    <tr>
                        <td width="40%"><?php echo _LB_REGION; ?></td>
                        <td width="60%">
                            <select id="region" name="region" style="width: 180px;">
                                <option value=""><?php echo _LB_CHOOSE; ?></option>
                                <?php while($region->fetchNext()) { ?>
                                   <option value="<?php echo $region->id; ?>" <?php if($region->id == $filter['region']) {?>selected="true"<?php }?>><?php echo $region->name; ?></option>
                                <?php } ?>
                            </select>
                        </td>
                    </tr>
				<tr>
					<td class="submit" colspan="2" style="padding-top:10px;">
						<a id="auto_ship_schedule_search" class="tribullet" style="flast_arriving_portt:right" id="obj_search" href="#" onclick="document.form_filter.submit();"><?php echo _LB_FIND;?></a>
					</td>
				</tr>
				</form>
				</table>
			</div>
		</div>
	</div>

	<div class="two_third" style="height:1%">
		<div class="box_two_third">
			<div class="box_head"><?php echo _LB_SHIP_SCHEDULE_ARRIVING; ?></div>
			<div class="box_content">
			<?php if($ship_schedule->countRows()) { ?>
					<?php while($ship_schedule->fetchNext()) { ?>
					<div class="object" robotid="<?php echo $ship_schedule->id; ?>">
						<div class="head">
							<div class="right remove_top">
								<a id="auto_ship_schedule_edit_<?php echo $ship_schedule->id;?>" href="<?php echo APPLICATION_URL;?>/ship_schedule/arriving_form/<?php echo $ship_schedule->id;?>">
									<img src="<?php echo IMG_URL;?><?php echo IMAGE_NAME_EDIT_SMALL;?>" title="<?php echo _LB_EDIT;?>" alt="<?php echo _LB_EDIT;?>"/>
								</a>
								
                                <a id="auto_ship_schedule_delete_<?php echo $ship_schedule->id;?>" onclick="return confirm('<?php echo _MSG_SHIP_SCHEDULE_ARRIVING_DELETE_CONFIRM;?>');" href="<?php echo APPLICATION_URL;?>/ship_schedule/arriving_delete/<?php echo $ship_schedule->id;?>">
                                    <img src="<?php echo IMG_URL;?><?php echo IMAGE_NAME_DELETE_SMALL?>" title="<?php echo _LB_DELETE;?>" alt="<?php echo _LB_DELETE;?>"/>
                                </a>
							</div>
							<?php echo substr(date_sql_to_date($ship_schedule->date_time), 0, 10); ?>:&nbsp;<b><?php echo $ship_schedule->ship_name;?></b>&nbsp;<?php echo _LB_LEAVING;?>&nbsp;<b><?php echo Port::getPorts($ship_schedule->leaving_port); ?></b>&nbsp;<?php echo _LB_ARRIVING;?>&nbsp;<b><?php echo Port::getPorts($ship_schedule->arriving_port); ?></b>&nbsp;<?php echo _LB_AT;?>&nbsp;<?php echo substr($ship_schedule->date_time, 11, 5); ?>
						</div>
						<div class="content">
							<table border="0" cellpadding="3" cellspacing="0">
                                <tr>
									<td width="20%"><?php echo _LB_NATIONALITY;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->country_name; ?>
									</td>
								</tr>
								<?php if($ship_schedule->grt) { ?>
                                <tr>
									<td width="20%"><?php echo _LB_GRT;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->grt; ?>
									</td>
								</tr>
                                <?php } ?>
                                <?php if($ship_schedule->dwt) { ?>
                                <tr>
									<td width="20%"><?php echo _LB_DWT;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->dwt; ?>
									</td>
								</tr>
                                <?php } ?>
                                <?php if($ship_schedule->draf) { ?>
                                <tr>
									<td width="20%"><?php echo _LB_DRAF;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->draf; ?>
									</td>
								</tr>
                                <?php } ?>
                                <?php if($ship_schedule->loa) { ?>
                                <tr>
									<td width="20%"><?php echo _LB_LOA;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->loa; ?>
									</td>
								</tr>
                                <?php } ?>
                                <?php if($ship_schedule->advertiser) { ?>
                                <tr>
									<td width="20%"><?php echo _LB_ADVERTISER;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->advertiser; ?>
									</td>
								</tr>
                                <?php } ?>
                                <?php if($ship_schedule->goods) { ?>
                                <tr>
									<td width="20%"><?php echo _LB_GOODS;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->goods; ?>
									</td>
								</tr>
                                <?php } ?>
                                <?php if( $ship_schedule->region_name) { ?>
								<tr>
									<td width="20%"><?php echo _LB_REGION;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo $ship_schedule->region_name; ?>
									</td>
								</tr>
                                <?php } ?>
                            </table>
						</div>
					</div>
					<?php } ?>
			<?php } else { ?>
				<p><?php echo _MSG_NO_EXISTING_SHIP_SCHEDULE_ARRIVING;?></p>
			<?php } ?>
			</div>
		</div>
		
	</div>
<?php include("footer.php"); ?>
